<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width,initial-scale=1.0">
        <title>后台管理系统</title>
        
        <link href="https://cdn.bootcss.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
        <link href="https://cdn.bootcss.com/bootstrap/3.1.1/css/bootstrap-theme.min.css" rel="stylesheet">
        <link rel="stylesheet" href="/css/pcStyle.css">
      
        <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
        <!-- <script src="http://code.highcharts.com/highcharts.js"></script> -->
    </head>
<body>
    <div id="userId" style="display:none;"><?php echo $_SESSION['userId'];?></div>
        <div class="header">
            <button type="button" class="navbarToggle fl">
                <span class="iconBar"></span>
                <span class="iconBar"></span>
                <span class="iconBar"></span>
            </button>
            <div class="fl title">
                <span>管理系统</span>    
            </div>  
            <div class="fr login">
                <img class="loginPic" src="/imgs/login.png" alt="">  
                <span><?php echo $_SESSION['username'];?></span>
                <img class="arrows" src="/imgs/ic_arrows.png" alt="">    
            </div>
            <div class="fr download">
                <!-- <a href="/download/jhdy.apk" target="_blank">下载app</a> -->
             </div>
            <div class="quit red" id="quit">退 出</div>
        </div>
    <?php 

        function checkCurrentItem($currURI)
        {
            $reqURI = $_SERVER['REQUEST_URI'];
            if ($reqURI == $currURI) {
                echo "class=cur";
            }
            
            return "";
        }
 ?>
        <div class="main">
            <div class="row" style=" margin: 0;">
                <div class="nav col-xs-4 col-sm-2 sidebar-offcanvas">
                    <h2><a href="/">首页</a></h2>
                    <!-- admin start -->
                    <div>
                        <img class="icon" src="/imgs/ic_power.png" alt="">   
                        <span>管理</span>
                        <img class="ricon" src="/imgs/triangle.png" alt=""> 
                    </div>
                    <ul>
                        <li <?php checkCurrentItem("/user/index"); ?>><a href="/user/index">用户管理</a></li>
                        <li <?php checkCurrentItem("/catalog/index"); ?> ><a href="/catalog/index">栏目管理</a></li>
                        <li <?php checkCurrentItem("/article/admin"); ?> ><a href="/article/admin">内容管理</a></li>
                        <li <?php checkCurrentItem("/images/index"); ?>><a href="/images/index">图片管理</a></li>
                        <li <?php checkCurrentItem("/config/update"); ?>><a href="/config/update">网站设置</a></li>
                    </ul>
                    <!-- <div>
                        <img class="icon" src="/imgs/light.png" alt="">
                        <span>广告管理</span>
                        <img class="ricon" src="/imgs/triangle.png" alt=""> 
                     </div>
                    < <ul>
                        <li <?php checkCurrentItem("/ads/index"); ?> ><a href="/ads/index">广告管理</a></li>
                        <li <?php checkCurrentItem("/ads/add"); ?>><a href="/ads/add">添加广告</a></li>
                    </ul>
                     <div>
                        <img class="icon" src="/imgs/ic_settings.png" alt="">
                        <span>其他</span>
                        <img class="ricon" src="/imgs/triangle.png" alt=""> 
                    </div>
                    <ul>
                        <li <?php checkCurrentItem("/article/index"); ?>><a href="/article/index">首页内容</a></li>
                    </ul>
                     -->
             </div>
    <script>
            var header = $(".header .navbarToggle");
            var nav = $(".main .nav");
            header.bind("click",function(){
                nav.toggle();
            });

            $("#quit").bind("click",function(){
                window.location="/user/logout";
            });
            
            if (navigator.userAgent.match(/mobile/i)  && !navigator.userAgent.match(/pad/i) ) {
                document.write('<link rel="stylesheet" href="/css/phoneStyle.css"/>');
                $(".top .left").width( screenWidth -60 +"px" );
                $(".top .right").width( screenWidth - 60  +"px" );
            }else{
                var screenWidth = $(window).width();
                $(window).resize(function(){
                    screenWidth = $(window).width();
                    if ( screenWidth < 768 ) {
                        $(".top .left").width( (screenWidth - 30  - 20)/2 -30 +"px" );
                        $(".top .right").width( (screenWidth - 30  - 20)/2 - 30 +"px" );
                        $(".top .right").css("marginLeft","18px");
                        $(".main").height( "905px");
                        header.show();
                        nav.hide();
                        nav.css({ "position": "absolute", "top":"60px", "left":"0", "z-index": "999","border": "1px solid #E3EAF2" ,"boxShadow": "5px 0px 10px 0px #D1DCE8" });
                    }else{
                        var leftWidth = $(".top .left").width();
                        $(".top .left").width( (screenWidth*5/6 - 30  - 20)/2 -30 +"px" );
                        $(".top .right").width( (screenWidth*5/6 - 30  - 20)/2 - 30 +"px" );
                        $(".top .right").css("marginLeft","18px");
                        $(".main").height( "730px");
                        header.hide();
                        nav.show();
                        nav.css({ "position":"","top":"0","boxShadow":"none"});
                    }
                });
                $(window).resize();
            }

            $(".header .login").bind("click",function(){
                $(".header .quit").toggle();
                // window.open("/user/logout");
            });
        </script>

    